<!DOCTYPE html>
<html>

<head>

  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">


  <title>当地名人详情</title>
  <meta name="keywords" content="">
  <meta name="description" content="">

  <link rel="shortcut icon" href="favicon.ico">
  <link href="/static/hAdmin/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
  <link href="/static/hAdmin/css/font-awesome.css?v=4.4.0" rel="stylesheet">
  <!-- Sweet Alert -->
  <link href="/static/hAdmin/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
  <link href="/static/hAdmin/css/animate.css" rel="stylesheet">
  <link href="/static/hAdmin/css/style.css?v=4.1.0" rel="stylesheet">
  <link href="/static/hAdmin/css/plugins/toastr/toastr.min.css" rel="stylesheet">
  <style>
      .addList {
          padding: 10px 30px 10px 30px;
          height: 90px;
          margin-top: 3px
      }
  </style>
</head>

<body class="gray-bg">
<div class="row">
  <span id="gloUrl" style="display: none"></span>
  <div class="col-xs-10 col-xs-offset-1">
    <div class="wrapper wrapper-content animated fadeInUp">
      <div class="ibox">
        <div class="ibox-content">
          <div class="row">
            <div class="col-sm-12">
              <div class="m-b-md">
                <div class="text-right">

<button class="btn btn-sm btn-default" id="back"><i class="fa fa-backward"></i> 返回</button>
                </div>

                <h2 >
                  <span id="title"></span>
                  <span> 详细信息</span>
                </h2>
              </div>
              <dl class="dl-horizontal">
                <dt>当地名人编号：</dt>
                <dd><span class="label label-default" id="gid"></span>
                </dd>
              </dl>
            </div>
          </div>
          <div class="row">
            <div class="col-sm-5">
              <dl class="dl-horizontal" id="dlList">

                <dt>当地名人名：</dt>
                <dd id="username"></dd>

              </dl>
            </div>
            <div class="col-sm-7" id="cluster_info">
              <dl class="dl-horizontal">

                <dt>生年：</dt>
                <dd ><i id="age" ></i></dd>


              </dl>
            </div>
          </div>
          <div class="row">

            <div class="col-sm-7">
              <dl class="dl-horizontal" >

                <dt title="性别">性别：</dt>
                <dd id="gender">

                </dd>

              </dl>
            </div>

          </div>
          <div class="row">
            <div class="col-sm-5">
              <dl class="dl-horizontal">

                <dt>档案号：</dt>
                <dd >
                  <i id="phonenumber" > </i>
                </dd>

              </dl>
            </div>

          </div>
          <div class="row">
            <div class="col-sm-5">
              <dl class="dl-horizontal">

                <dt>创建时间 ：</dt>
                <dd >
                  <i id="createTime"> </i>
                </dd>

              </dl>
            </div>
<!--            <div class="col-sm-7">-->
<!--              <dl class="dl-horizontal" >-->

<!--                <dt>喜欢数量：</dt>-->
<!--                <dd id="glike">-->

<!--                </dd>-->

<!--              </dl>-->
<!--            </div>-->
          </div>
          <div class="row">


          </div>   <div class="row">

            <div class="col-sm-7">
              <dl class="dl-horizontal" >
                <dt>当地名人照片：</dt>
                <dd >
                  <img src="" style="width: 200px;height: 200px;" id="img" alt="">
                </dd>


              </dl>
            </div>
          </div>
          <div class="ibox-title" style="height: 55px;">
            <h5>当地名人景点/特色</h5>
            <div class="ibox-tools">
              <div class="text-center">
                <!--                            <button class="btn btn-primary " data-target="#myModal" data-toggle="modal" type="button">-->
                <!--                                添加捐赠记录-->
                <!--                            </button>-->
              </div>

            </div>
          </div>
          <div class="project-list">
            <table class="table table-hover">
              <tbody id="listBody"></tbody>
            </table>
          </div>
          <!--                        页码控制-->
          <div ajaxUrl="www.baidu.com" currentPage="1" id="pageHelper">
            <div class="pageBottom col-xs-10 col-xs-offset-1" style="margin-top: 20px">
              <nav aria-label="...">
                <ul class="pager">
                  <li class="previous disabled"><a href="javascript:void(0)"><span aria-hidden="true">&larr;</span>
                    上一页</a></li>
                  <li>
                    <span>共</span>
                    <span id="data_total">${total}</span>
                    <span>条数据</span>
                  </li>
                  <li class="next"><a href="javascript:void(0)">下一页 <span
                          aria-hidden="true">&rarr;</span></a></li>
                </ul>
              </nav>
            </div>
          </div>
        </div>
      </div>
      <hr>


    </div>
  </div>

</div>


<!-- 全局js -->
<script src="/static/hAdmin/js/jquery.min.js?v=2.1.4"></script>
<script src="/static/hAdmin/js/bootstrap.min.js?v=3.3.6"></script>
<!-- Sweet alert -->
<script src="/static/hAdmin/js/plugins/sweetalert/sweetalert.min.js"></script>

<!-- 自定义js -->
<script src="/static/hAdmin/js/content.js?v=1.0.0"></script>
<!--    分页js -->
<!--<script src="/static/wmmJs/public/PageHelper.js"></script>-->
<script src="/static/hAdmin/js/plugins/toastr/toastr.min.js"></script>
<script src="/static/js/GloJs.js"></script>

<script>
  $(function (){
    let Glo_BaseUrl = $("#gloUrl").attr("gloUValue")
    let Glo_user = localStorage.getItem("userId")
    let id = localStorage.getItem("id");
    let currentPage = $("#pageHelper").attr("currentPage");
$("#back").click(function (){
  history.go(-1)
})


    //获取详情接口
    function getDetail(){
      $.ajax({
        url: Glo_BaseUrl + "/teacher/detail",
        type: "get",
        data: {
          "id":id,

        },
        success: function (data) {
          $("#gid").text(data.Data.id)
          $("#username").text(data.Data.username)
          $("#age").text(data.Data.age)


          $("#gphoto").prop("src",data.Data.pic)


          $("#phonenumber").text(data.Data.phonenumber)
            if (data.Data.gender === "1"){
                $("#gender").text("男")
            }else {
                $("#gender").text("女")
            }

          $("#createTime").text(data.Data.createtime)

                $("#img").prop("src",data.Data.img)


        },
        error: function () {
          alert("服务器异常！network error！")
        }
      })
    }
    getDetail();

      function getTitleList() {
          let total = 0;//总数
          let pageSize = 6;//每页条数
          let html_dom = $("#listBody")

          setTimeout(function () {
              $.ajax({
                  url: Glo_BaseUrl + "/courseInfo/list",
                  type: "get",
                  data: {
                      "pageSize": pageSize,
                      "pageNum": currentPage,
                      "teacherId":id
                  },
                  success: function (data) {
                      let ListStr = ''
                      total = data.total
                      for (let i = 0; i < data.list.length; i++) {
                          ListStr +=`  <div class="marTop20 col-xs-12">
                                    <div class="row">
                                        <div class="col-md-7">
                                            <a data-toggle="collapse" href="faq.html#faq${data.list[i].id}" class="faq-question">${data.list[i].courseName}</a>
                                            <small><strong>游玩时间：</strong> <i class="fa fa-clock-o"></i>${data.list[i].learningCycle}</small>
                                        </div>
                                        <div class="col-md-3">

                                        </div>

                                    </div>
                                    <div class="row">
                                        <div class="col-sm-12">
                                            <div id="faq${data.list[i].id}" class="panel-collapse faq-answer collapse" aria-expanded="false" style="height: 32px;">
                                                <span style="font-size: 18px">
                                                   ${data.list[i].content}
                                                </span>
                                            </div>
                                        </div>
                                    </div>
                                </div>`

                      }

                      if (data.code !== 500) {
                          html_dom.html("")
                          html_dom.append(ListStr)
                          getRoleSetMenu()
                      } else {
                          alert("获取失败")
                      }
                      total = data.total
$(".seeVideo").click(function (){
   // let sr = $(this).attr("thisSrc")
// window.open(sr)
})
                      $("#data_total").html(data.total);
                      //下一页
                      $('.next').unbind().click(function () {
                          if (currentPage * pageSize >= total) {
                              toastr.error("已经是最后一页了！", '提醒')
                          } else {
                              currentPage++;
                              $("#pageHelper").attr("currentPage", currentPage);
                              if (currentPage > 0) {
                                  $(".previous").removeClass("disabled")
                              }
                              $(".project-list").addClass("animated bounceOutLeft")
                              setTimeout(function () {
                                  $(".project-list").removeClass("animated bounceOutLeft").addClass("animated bounceInRight")
                              }, 500)
                              getTitleList(2)
                          }

                      });
                      //上一页
                      $('.previous').unbind().click(function () {
                          currentPage--;
                          $("#pageHelper").attr("currentPage", currentPage);
                          if (currentPage === 0) {
                              currentPage = 1;
                              $("#pageHelper").attr("currentPage", currentPage);
                              $(".previous").addClass("disabled");
                          } else {
                              $(".project-list").addClass("animated bounceOutRight")
                              setTimeout(function () {
                                  $(".project-list").removeClass("animated bounceOutRight bounceInRight").addClass("animated bounceInLeft")
                              }, 500)
                              getTitleList(2)
                          }
                      });

                  },
                  error: function () {
                      alert("服务器异常！network error！")
                  }
              });
          }, 300)


      }
      getTitleList()
    //确认修改
    $("#confirmAddEq").click(function () {

      var formData = new FormData();//这里需要实例化一个FormData来进行文件上传
      formData.append("file",$("#insFile")[0].files[0]);
      formData.append("foodName",$("#insfoodName").val());
      formData.append("price",$("#insprice").val());

      formData.append("kind",$("#inskind").val());

      formData.append("describe",$("#insdescribe").val());
      formData.append("businessId",localStorage.getItem("id"));


      if ($("#insFile")[0].files[0] === undefined || $("#insFile")[0].files[0] === null){
        toastr.error('文件不能为空', '提示');
        return false;
      }
      $.ajax({
        url: Glo_BaseUrl + "/tFood/add",
        type: "post",
        data: formData,
        processData : false,
        contentType : false,
        success: function (data) {

          $("#close").click()
          getList()
          toastr.success(data.msg, '提示')

        },
        error: function () {
          alert("服务器异常！network error！")
        }
      })
    })
      //确认当地名人信息
      $("#handleOrder").click(function () {

          swal({
              title: "您确定要订购该当地名人景点/特色信息吗",
              text: "确认后可下载该当地名人的相关电子入场券！",
              type: "warning",
              showCancelButton: true,
              confirmButtonColor: "#DD6B55",
              confirmButtonText: "确认",
              closeOnConfirm: false
          }, function () {
              $.ajax({
                  url: Glo_BaseUrl + "/order/add",
                  type: "post",
                  data: {
                      courseId: id,
                      userId: Glo_user,
                  },
                  success: function (data) {
                      windowsAuto(data.code, data.msg)
                      getDetail()
                  },
                  error: function () {
                      alert("服务器异常！network error！")
                  }
              })

          });

      });


  });

</script>


</body>

</html>
